{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# CART 和 决策树的超参数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn import datasets\n",
    "\n",
    "X, y = datasets.make_moons(noise=0.25, random_state=666)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAD8CAYAAACfF6SlAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAHSFJREFUeJzt3X2MXFd5x/HvE8eQhSJvgl2SrG2ctGkgrzWswosRSmNoSGgSE0Ia+INQERnaRrSpFNUIyViRqhgiNWoaWmQFRCKVEBPAmGJkIAalSpuUNYntvGAwAYqXQEIgpggX/PL0j7kTz87embkz98y95977+0jWzs5czz17d/aZM895zjnm7oiISLMcV3YDRESkeAr+IiINpOAvItJACv4iIg2k4C8i0kAK/iIiDaTgLyLSQAr+IiINFCT4m9knzexpM3u0x+MXmtkBM3sk+bc+xHlFRGQ0xwd6nk8BtwN39TnmP9z9z7I+4eLFi33FihU5myUi0iw7d+78ubsvGXRckODv7veb2YoQz9W2YsUKZmZmQj6liEjtmdmPshxXZM7/dWa2y8y+YmZnpx1gZmvNbMbMZp555pkCmyYi0ixFBf9vAy939/OBfwa2pB3k7pvcfdrdp5csGfipRURERlRI8Hf3X7n7r5Pb24CFZra4iHOLiMh8hQR/MzvZzCy5fUFy3meLOLeIiMwXZMDXzO4GLgQWm9l+4MPAQgB3/zhwFfCX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D3JcxyK2cewp0C5hb3D3WTP7feBrZvadpOcRS/vGql8bO79xdzezXqVdL0+u4enADjPb4+7fD93WGvkScLe7/9bM3kfrU8pFJbepSr5N6zX3azO7FNgCnFFGQ8zs94DPAX/r7r8qow39DGhfrutYavD3/LuE4e6zydenzewLtD62Bwn+Ado39l3M+rXRzH5mZqe4+1PJx9WnezxH+xo+aWbfpNXLGFfwz3JN2sfsN7PjgUXAs2NqT7eB7XP3zrbcQWtsJSZR757XGcTcfZuZ/YuZLXb3QtfTMbOFtALrv7n751MOKfU6Dmpf3utY6bSPmb3YzF7Svg38KZBaYVCSsncx2wpcm9y+Fpj3acXMTjSzFya3FwOrgMfH2KYs16Sz3VcBOzwZ4SrAwPZ15X0vp5WPjclW4N1JtcprgQMd6b/SmdnJ7TEcM7uAVhwq6s293QYDPgE84e7/2OOw0q5jlvblvo5FjV6PMNr9Nlo5tt8CPwO2J/efCmxLbp9OqxpjF/AYrXRMNO3zYxUD36XVky6sfcm5XwrcB3wP+DpwUnL/NHBHcvv1wJ7kGu4B3ltAu+ZdE+Am4PLk9gnAZ4F9wH8Dpxd83Qa17+bk9bYL+AbwioLbdzfwFHAoeQ2+F3g/8P7kcQM+lrR/D32q5Upq3/Ud1+9B4PVFti9pwxtojRfuBh5J/l0ay3XM2L5c11EzfEVEGqjSaR8RERmNgr+ISAMp+IuINJCCv4hIAyn4i4g0kIK/iEgDKfiLiDSQgr+ISAP9P751Ee5YRd5MAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1087f1550>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X[y == 0, 0], X[y == 0, 1])\n",
    "plt.scatter(X[y == 1, 0], X[y == 1, 1])\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DecisionTreeClassifier(class_weight=None, criterion='gini', max_depth=None,\n            max_features=None, max_leaf_nodes=None,\n            min_impurity_decrease=0.0, min_impurity_split=None,\n            min_samples_leaf=1, min_samples_split=2,\n            min_weight_fraction_leaf=0.0, presort=False, random_state=None,\n            splitter='best')"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.tree.tree import DecisionTreeClassifier\n",
    "\n",
    "# 这次我们不传参数，那么，默认使用的判断标准是基尼系数\n",
    "# 不设置max depth，它就会一直分到所有叶子节点的基尼系数都减小到0为止。\n",
    "dt_clf = DecisionTreeClassifier()\n",
    "dt_clf.fit(X,y)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 绘制决策边界\n",
    "### 不剪枝（使用max depth）的情况下"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/local/seamonster/MachineLearningClassicAlgorithmEnv/lib/python3.6/site-packages/matplotlib/contour.py:967: UserWarning: The following kwargs were not used by contour: 'linewidth'\n  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAIABJREFUeJzt3X+QHOV95/H3V7sLO4KVhBBYiwTIBKSA4AoBxZmI+CgiUkjlgHORY5xzRaac0vl8GHyus88pVSlXVLlix1WUMThx6QgOPiiwvbnD4liFIGQOogQf4qckFLCgDGhZLBlZqwFWsD+e+2N6VrOzMzs/uqf76e7Pq0qlmdnZ6Wd7Zvrbz/f5Pk+bcw4REZE5STdARET8oIAgIiKAAoKIiAQUEEREBFBAEBGRgAKCiIgAEQUEM7vbzA6a2Z46P7/KzEbM7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rfNufTbaz5f2ppStERARIWcpIREQ6RwFBREQABQQREQkoIIiICKCAICIiAQUEEREBFBBERCTw/wHPNh2yNgRwBgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x108d03898>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from playML.plot_utils import plot_decision_boundary\n",
    "\n",
    "plot_decision_boundary(dt_clf, axis=[-1.5, 2.5, -1.0, 1.5])\n",
    "plt.scatter(X[y==0,0],X[y==0,1])\n",
    "plt.scatter(X[y==1,0],X[y==1,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "边界极为不规则，很明显是过拟合\n",
    "### 使用max depth剪枝的情况"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/local/seamonster/MachineLearningClassicAlgorithmEnv/lib/python3.6/site-packages/matplotlib/contour.py:967: UserWarning: The following kwargs were not used by contour: 'linewidth'\n  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAHv9JREFUeJzt3X+QHOWd3/H3V7trtHAjCSGw1hIIY5AChpyFVJx94lKcT04h1QVyObmM88dhCpfiONi5uK7unFJKl6KOin2pIrkDX64UjjtIXWHHusQWsRSCLDu+6IKDwGBAMlgQ2+zeYmEUpAVWeH9888f0LLujmZ2e6Z7up7s/ryqVZmd7p5/t2elv9/f5Ps9j7o6IiMiSvBsgIiJhUEAQERFAAUFERCIKCCIiAiggiIhIRAFBRESAlAKCmd1vZifM7Nk237/BzE6Z2V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Pr9N91HvuwlNIaaPmX9Cc/f9ZvYnZrbK3TOdUM7MhqifZP/S3f9Li02COJ6d2tnL8SxUysjMzjOzWuMx8Pepr8kQmhCm69gH3Bo9vhU4687GzM43s3Oix6uALWQzLXmc4zO//TuAQx71lGWoYzubcsc3Uc/lhmYf8FtRdcwHgVPz0onBMLPVjX4iM7uO+vkp04uAaP9/Bhxz97vbbJb78YzTzp6OZ9a944v0mv8G9Vzc28BPgUei598D7I8eX0a90uNp4DnqKZzg2unvVCK8QP1qO492XgB8E/ghcBBYGT2/GbgvevzLwDPR8XwGuD3D9p11fIA7gZuix0uBrwLHgf8DXJbT32Wndv6b6G/xaeBbwN/JoY0PAePAVPS3eTvwKeBT0feN+iJVL0bvc9sqvpzbece8Y/kY8Ms5tPF66v2U3weeiv5tD+14xmxn18dTU1eIiAhQsJSRiIj0jwKCiIgACggiIhJRQBAREUABQUREIgoIIiICKCCIiEjk/wOdqOTqfue/ygAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x106341a20>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "dt_clf2 = DecisionTreeClassifier(max_depth=2)\n",
    "dt_clf2.fit(X,y)\n",
    "plot_decision_boundary(dt_clf2, axis=[-1.5, 2.5, -1.0, 1.5])\n",
    "plt.scatter(X[y==0,0],X[y==0,1])\n",
    "plt.scatter(X[y==1,0],X[y==1,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "可以看到边界比较规则了，解决了过拟合的问题。当然，也有可能问题变为欠拟合了"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 使用其他的超参数进行剪枝\n",
    "#### min samples split"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/local/seamonster/MachineLearningClassicAlgorithmEnv/lib/python3.6/site-packages/matplotlib/contour.py:967: UserWarning: The following kwargs were not used by contour: 'linewidth'\n  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAHutJREFUeJzt3X+QHOWd3/H3V7trtHArCSGw1hIIcyCFXwn6UZx94lKUT6SQ6g5yObmMU6nDFC7FcbB9caXufKUqXYoqV+xLFYkNvlwpHD7IucCxLrFFLIUgy44dXXD4bUAcWBDbaG+xMDqkBVZ4f3zzx/Qss6OZnZ7pnu6nuz+vKpVmZ3unn+3Z6W8/3+f7PG3ujoiIyKK8GyAiImFQQBAREUABQUREIgoIIiICKCCIiEhEAUFERICUAoKZ3WNmx8zs2Tbfv9bMTpjZU9G/XWnsV0RE0jOY0uv8BXAXcN8C2/zA3X8rpf2JiEjKUukhuPv3geNpvJaIiOQjrR5CHB80s6eBvwX+tbs/17yBme0AdgCcdcYZGy9ZuTLD5olIXK8Pn5N3E6SNV/7miV+4+7m9/GxWAeEJYI27v2lm24BvApc0b+Tuu4HdAOsvvNC/u3NnRs0TkW7ce9XNeTdB2vj9q8/4aa8/m0mVkbufdPc3o8f7gCEzW5HFvkVEJJ5MAoKZrTQzix5fHe339Sz2LSIi8aSSMjKz+4FrgRVmdhT4Y2AIwN3/DNgO/AszmwYmgZtcy6yKiAQllYDg7h/t8P27qJWliohIoDRTWUREgGzLTqWg9k0Mc+fxEV6dHmDl4AyfWj7BtpHJvJslIilTQCiRfpy4900Mc/trSznltc7k+PQgt7+2FEBBQaRklDIqifqJe3x6EMfmTtz7JoYTve6dx0fmgkHdKV/EncdHEr2uiIRHAaEk+nXifnV6oKvnRaS4FBBKol8n7pWDM109LyLFpYBQEv06cX9q+QSLbXbec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BERifx/+zDUytFXte4AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1093a7860>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 一个节点的样本数至少要超过多少才会对其继续划分\n",
    "dt_clf3 = DecisionTreeClassifier(min_samples_split=10)\n",
    "dt_clf3.fit(X,y)\n",
    "plot_decision_boundary(dt_clf3, axis=[-1.5, 2.5, -1.0, 1.5])\n",
    "plt.scatter(X[y==0,0],X[y==0,1])\n",
    "plt.scatter(X[y==1,0],X[y==1,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### min samples leaf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/local/seamonster/MachineLearningClassicAlgorithmEnv/lib/python3.6/site-packages/matplotlib/contour.py:967: UserWarning: The following kwargs were not used by contour: 'linewidth'\n  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAH2xJREFUeJzt3X+MXeV95/H31zODZ3DGNmCIJzY2oWCvCalqbNEkphVKzSq2trDZUoX0jxKUyMtmSTZKqzaVJXeFijbpaqM2obuVl9LCahWynd0Ss7FFcZwsqVuy/AgEYy/EoEBmOsQEZHuAMZ0f3/3jnmvuXN/f59xznnPO5yVZvnPn+J7H5957vuf5Pt/nOebuiIiILMm6ASIiEgYFBBERARQQREQkooAgIiKAAoKIiEQUEEREBEgoIJjZvWZ2wsyONPn99WZ2ysyejv7sSWK/IiKSnMGEXuevgLuB+1ts8313/xcJ7U9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lc/jm2a2E3gQuDKLhpjZe4D/CXzB3U9n0YZOtGln18cz1YDg8ZfBwN0no79PmNnfUOnWJxoQEmhnKst1tGqnmf3MzMbcfSrqzp5o8hrV4/mSmX2PypVGvwNCJ8enus2EmQ0CK4DX+9yuem3b6e61bbqHythNaHKxfEztCc3d95vZfzazVe6e6oJyZjZE5ST73939fzXYJIjj2a6dvRzPXKWMzGyZmY1WHwP/nMo9GUITwnId+4Bbo8e3Auf0bMzsAjNbGj1eBWwjnWXJOzk+te2/GTjk0UhZitq2sy53fCOVXG5o9gG/HVXHfAg4VZNODIaZra6OE5nZtVTOT6leBET7/wvgmLt/tclmmR/PTtrZ0/FMe3S8xaj5x6nk4t4BfgY8HD3/PmB/9PhyKpUezwDPUUnhBNdOf7cS4QUqV9tZtPMi4DvAj4GDwIXR81uBe6LHHwGejY7ns8CnU2zfOccHuBO4MXo8DPw1cBz4v8DlGX0u27XzP0SfxWeA7wL/LIM2fgOYAmajz+angduB26PfG5WbVL0Yvc9Nq/gybucdNcfyMeAjGbTxOirjlD8Cno7+7AzteHbYzq6Pp5auEBERIGcpIxER6R8FBBERARQQREQkooAgIiKAAoKIiEQUEEREBFBAEBGRyP8H0U/u0ZfJUKMAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1095f90b8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 每个叶子节点起码要有多少个样本\n",
    "dt_clf4 = DecisionTreeClassifier(min_samples_leaf=6)\n",
    "dt_clf4.fit(X,y)\n",
    "plot_decision_boundary(dt_clf4, axis=[-1.5, 2.5, -1.0, 1.5])\n",
    "plt.scatter(X[y==0,0],X[y==0,1])\n",
    "plt.scatter(X[y==1,0],X[y==1,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### max leaf nodes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/local/seamonster/MachineLearningClassicAlgorithmEnv/lib/python3.6/site-packages/matplotlib/contour.py:967: UserWarning: The following kwargs were not used by contour: 'linewidth'\n  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAHv9JREFUeJzt3X+QHOWd3/H3V7trtHAjCSGw1hIIY5AChpyFVJx94lKcT04h1QVyObmM88dhCpfiONi5uK7unFJKl6KOin2pIrkDX64UjjtIXWHHusQWsRSCLDu+6IKDwGBAMlgQ2+zeYmEUpAVWeH9888f0LLujmZ2e6Z7up7s/ryqVZmd7p5/t2elv9/f5Ps9j7o6IiMiSvBsgIiJhUEAQERFAAUFERCIKCCIiAiggiIhIRAFBRESAlAKCmd1vZifM7Nk237/BzE6Z2VPRv91p7FdERNIzmNLr/AVwL/DgItv8tbv/ekr7ExGRlKVyh+Du3wFOpvFaIiKSj7TuEOL4kJk9Dfwt8Dvu/lzzBma2E9gJcN4552y6YvXqDJsnInG9NnxB3k2QNl7+wZM/c/cLe/nZrALCk8A6d3/DzLYDXwOuaN7I3fcAewA2Xnqpf2vXroyaJyLdeOADt+bdBGnjt68758e9/mwmVUbuftrd34ge7weGzGxVFvsWEZF4MgkIZrbazCx6fF2039ey2LeIiMSTSsrIzB4CbgBWmdko8PvAEIC7/ymwA/inZjYNTAK3uKZZFREJSioBwd0/3uH791IvSxURkUBppLKIiADZlp1KQe2fGOaekzVemR5g9eAMn1k5wfbaZN7NEpGUKSCUSD9O3Psnhrnz1eWc8frN5Pj0IHe+uhxAQUGkZJQyKonGiXt8ehDH5k7c+yeGE73uPSdrc8Gg4Ywv4Z6TtUSvKy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QBAREUABQUREIgoIIiICKCCIiEjk/wOdqOTqfue/ygAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1095d3eb8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 最多只能有多少个叶子节点\n",
    "dt_clf5 = DecisionTreeClassifier(max_leaf_nodes=4)\n",
    "dt_clf5.fit(X,y)\n",
    "plot_decision_boundary(dt_clf5, axis=[-1.5, 2.5, -1.0, 1.5])\n",
    "plt.scatter(X[y==0,0],X[y==0,1])\n",
    "plt.scatter(X[y==1,0],X[y==1,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
